package com.apes.pi.model;

import com.apes.framework.jpa.DefaultPersistListener;
import com.apes.framework.jpa.Model;
import lombok.Getter;
import lombok.Setter;
import org.hibernate.annotations.DynamicInsert;
import org.hibernate.annotations.DynamicUpdate;
import org.hibernate.annotations.SelectBeforeUpdate;

import javax.persistence.*;

/**
 * 功能：接口时间戳
 *
 * @author xul
 * @create 2018-06-20 11:19
 */
@Getter
@Setter
@SelectBeforeUpdate
@DynamicInsert
@DynamicUpdate
@Entity
@EntityListeners(DefaultPersistListener.class)
@Table(name = Timestamp.CONST_TABLE_NAME)
public class Timestamp extends Model {
    public static final String CONST_TABLE_NAME = "res_timestamp";

    @Id
    @Column(name = "id", length = 60)
    private String id; //接口编号

    @Column(name = "type", nullable = false, length = 60)
    private String type; //类型：（'date'：日期），（'timestamp'：时间戳）

    @Column(name = "time", nullable = false, length = 30)
    private String time; //时间或时间戳

    @Column(name = "conditions", length = 30)
    private String conditions;

    @Column(name = "valid", nullable = false, columnDefinition = "number(1,0) default 1")
    private boolean valid = true; //有效
}
